﻿using System;
using System.ComponentModel.Composition;
using Crm2011.Framework.Core;
using Microsoft.Practices.Prism.Events;



namespace ScriptEase.Shell.Events
{
    /// <summary>
    /// A global event that will be raised after the connection to CRM has been changed.
    /// </summary>
    [Export]
    public class ConnectionStringChangedEvent : CompositePresentationEvent<ConnectionStringChangedEventArgs>
    {
    }


    [Export]
    public class ConnectionStringChangedEventArgs
    {
        private readonly CrmConnectionString _cns;
        private readonly Guid _connectionListId;



        public ConnectionStringChangedEventArgs(CrmConnectionString cns, Guid connectionListId)
        {
            _cns = cns;
            _connectionListId = connectionListId;
        }



        /// <summary>
        /// Gets the CRM connection string as clear text.
        /// </summary>
        public CrmConnectionString ConnectionString
        {
            get { return _cns; }
        }

        public Guid ConnectionListId
        {
            get { return _connectionListId; }
        }
    }
}